<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=latin1">
        <link rel="stylesheet" type="text/css" href="../padrao.css" />
        <script type="text/javascript" src="../simpleautocomplete/js/jquery.js"></script>
        <script type="text/javascript" src="../simpleautocomplete/js/simpleAutoComplete.js"></script>
        <link rel="stylesheet" type="text/css" href="../simpleautocomplete/css/simpleAutoComplete.css" />


        <script type="text/javascript"  language="Javascript">
            function valida(formulario){
                if(formulario.nome.value == ""){
                    alert("O nome nao foi preenchido");
                    return false; 
                }
                if(formulario.tipo.value == ""){
                    alert("O tipo de caminhao nao foi selecionado");
                    return false;
                }

                if(formulario.valor.value < 0 || formulario.valor.value == ""){
                    alert("O valor da venda deve ser estar preenchido e ser maior que zero");
                    return false;
                }
                return true;
            }


        </script>
        
        <script type="text/javascript">
            $(document).ready(function()
            {
                $('#estado_autocomplete').simpleAutoComplete('ajax_query.php');
            });
        </script>

        <script type="text/javascript"  language="Javascript">

            function disableEnterKey(e)
            {
                var key;
                if(window.event)
                    key = window.event.keyCode; //IE
                else
                    key = e.which; //firefox

                return (key != 13);
            }

        </script>



    </head>
    <body>
        <?php
        ob_start();
        include '../infobox.php';
        include '../menu.php';
        include '../verifica_usuario.php';
        include '../functions.php';
        include '../functions_office.php';
        $valor_minimo = $_SESSION[valor_minimo];
        ?>
        <div class="conteudo">
            <p class="titulopesquisa" align='center'> VENDAS </p>


            <form method="POST" onsubmit="return valida(this);" action="vendas_office_cont.php">
                <p align="center">
                <table>
                    <tr>
                        <td>Digite a empresa:</td>
                        <td> <input type="text"  id="estado_autocomplete" name="empresa_nome" autocomplete="off" style="width: 250px; height: 23px;" onKeyPress="return disableEnterKey(event)" /> </td>
                    </tr>
                    <tr>
                        <td>Aterro:</td>
                        <td>
                            <?php
                            include("mysqlconfig.inc");
                            $query = "SELECT nome FROM ATERROS";
                            /* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */
                            $result = mysql_query($query);
                            echo '<select name="aterro_nome"></option>';
                            // printing the list box select command

                            while ($nt = mysql_fetch_array($result)) {//Array or records stored in $nt
                                echo "<option value='$nt[nome]'>$nt[nome]</option>";
                                /* Option values are added by looping through the array */
                            }
                            echo "</select>"; // Closing of list box
                            mysql_close($con);
                            ?>
                        </td>
                    </tr>
                    
                    <tr>
                        <td>Credito para:</td>
                        <td>
                            <select name="tipo">
                                <option value = Poly > Poly </option>
                                <option value = Truck > Truck </option>
                                <option value = Toco > Toco </option>
                                <option value = Carreta > Carreta </option>
                                <option value = Transbordo > Transbordo </option>
                            </select>
                        </td>
                    </tr>
                    
                </table>
                <p align="center"><input value="confirma venda" type="submit"></p>
            </form>

            
        </div>
    </body>
</html>